#include <stdio.h>
#include <locale.h>

#define strlen 64
#define testcount 8

/* On Windows XP, setlocale (buggy) returns Chinese Traditional for
 * "chinese-simplified", On Windows Vista and Win7, this bug is fixed.
 *
 * On all versions of Windows, "zh_CN.utf8" is not supported by setlocale.
 *
 * On Windows XP, setlocale returns Chinese Traditional for "chinese", however,
 * on Windows Vista and Win7, setlocale returns Chinese Simplified for "chinese"
 *
 * http://msdn.microsoft.com/en-us/library/39cwe7zf.aspx
 */
 


int main(void)
{
    char* str;
    char target[testcount][strlen] = {"zh_CN.utf8", "chinese", "chinese-traditional", "chinese-simplified", "cht", "chs", "Chinese_People's Republic of China.936",
"Chinese_Taiwan.950"};
    int i;

    printf("start tests\n\n");
    for (i=0;i<testcount;i++)
    {
        printf("test%d:\n", i);
        str = setlocale(LC_ALL, NULL);
        printf("current locale is %s\n", str);
        printf("trying to set locale to %s\n",target[i]);
        str = setlocale(LC_ALL, target[i]);
        printf("string returned is %s\n", str);
        str = setlocale(LC_ALL, NULL);
        printf("new locale is %s\n", str);
        str = setlocale(LC_ALL, "C");
        printf("reset locale to %s\n", str);
        printf("\n");
    }


   return 0;
}
